[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
ssignal() Implement Software Signals
#include <signal.h>
int (*ssignal(sig,action))();
int sig; Type of signal
int (*action)(); Action function/Constant
ssignal() is used to establish an action routine for servicing a
signal. Software signals are integers in the range of 1 to 15.
'sig' is a number that identifies the type of signal; 'action' is the
name of a user-defined action function, or it is a constant: SIG_DFL
(default action) or SIG_IGN (ignore action) (defined in <signal.h>).
SIG_IGN means the interrupt signal is ignored. SIG_DFL terminates
the calling process and returns control to the MS-DOS command level.
If the action function has been established for 'sig', then that
action is reset to SIG_DFL, and the action function is entered with
'sig'.
Returns: The action previously established or SIG_DFL, if the
signal number is illegal.
-------------------------------- Example ---------------------------------
The following statements set up two software signals and call them.
#include <signal.h> /* for gsignal, ssignal and SIG_IGN */
#define ACTION1 1 /* uses software signal #1 */
#define ACTION2 6 /* uses software signal #6 */
int action1a()
{
return(100);
}
int action1b()
{
return(150);
}
int action2()
{
return(200);
}
main()
{
int sigval;
ssignal(ACTION1,action1a);
sigval = gsignal(ACTION1); /* sigval = 100 */
ssignal(ACTION2,action2);
sigval = gsignal(ACTION2); /* sigval = 200 */
ssignal(ACTION1,action1b);
sigval = gsignal(ACTION1); /* sigval = 150 */
ssignal(ACTION2,SIG_IGN);
sigval = gsignal(ACTION2); /* sigval = 1 */
}
See Also:
gsignal()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson